<!--图片类型-->

<template>
  <div class="message-image item-content">
    <img class="img" :src="fileUrl" @click="onShowDialog" />

    <!-- 图片查看dialog -->
    <el-dialog :visible.sync="dialogVisible" class="imgView-dialog" :modal="false" append-to-body>
      <div class="main">
        <img class="img" :src="fileUrl" />
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: 'message-image',
  props: {
    fileUrl: {
      type: String,
      default: '',
    },
  },
  data() {
    return {
      dialogVisible: false,
    };
  },
  methods: {
    /**
     * 图片查看dialog_显示
     */
    onShowDialog() {
      this.dialogVisible = true;
    },
  },
};
</script>

<style lang="scss" scoped>
.message-image {
  max-width: 320px;
  max-height: 240px;
  white-space: normal;
  word-wrap: break-word;
  word-break: break-all;
  padding: 5px;
  cursor: pointer;
}
</style>
